package com.czb.seckill.rabbitmq;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author: 陈正彬
 * 消息发送者，发送秒杀消息
 */
@Service
@Slf4j
public class MQSenderMessage {

    @Resource
    private RabbitTemplate rabbitTemplate;

    //方法发送秒杀消息
    public void sendSeckillMessage(String message) {
        log.info("发送消息-->" + message);
        rabbitTemplate.convertAndSend("seckillExchange", "seckill.message", message);
    }

}
